Skip to content

feat: add seekStart/seekFinished API, restart(), and onRestart callback#195

Merged
kdroidFilter merged 4 commits into
masterfrom
feat/seek-api-restart-and-loop-callback
Apr 11, 2026
Merged

feat: add seekStart/seekFinished API, restart(), and onRestart callback#195
kdroidFilter merged 4 commits into
masterfrom
feat/seek-api-restart-and-loop-callback

Conversation

@kdroidFilter

@kdroidFilter kdroidFilter commented Apr 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix Seek action will occur at the beginning of sliding #134 — Seek no longer triggers at the beginning of slider drag. Removed implicit seekTo from sliderPos setter on Android and Windows.
  • Fix How to restart a video ? #82play() now works correctly from ended state on Android (STATE_ENDED) and iOS. Added restart() method for reliable restart from any state.
  • New seekStart()/seekFinished() API — Clean slider interaction without exposing userDragging internals. Replaces the error-prone manual pattern.
  • New onRestart callback — Fires when loop=true and the video restarts from the beginning. Implemented across all platforms (Android, iOS, macOS, Linux, Windows, Web).
  • Web loop handling — Replaced native HTML5 loop with manual handling to support onRestart callback detection.
  • README updated — Documents the new seek API, restart(), onRestart, and onPlaybackEnded.

Test plan

  • Verify slider drag does not trigger a seek at the start of the interaction (Android)
  • Verify seekStart()/seekFinished() works correctly with Compose Slider
  • Verify seekTo() still works for programmatic seeking
  • Verify restart() works after video has ended (sliderPos == 1000f)
  • Verify onRestart fires on each loop iteration with loop = true
  • Verify onPlaybackEnded still fires when loop = false
  • Verify web loop behavior still works after removing native HTML5 loop

- Fix seek at beginning of slider drag (#134): remove implicit seekTo
  from sliderPos setter on Android and Windows
- Add seekStart()/seekFinished() for clean slider interactions
- Fix play() from ended state on Android (STATE_ENDED) and iOS (#82)
- Add restart() method to reliably restart from any state
- Add onRestart callback fired when loop=true and video restarts
- Handle loop manually on web instead of native HTML5 loop to support
  onRestart detection
- Update README with new seek API and playback callbacks documentation
Remove aggressive near-end snapping (10% threshold) that caused the
slider to jump to 100% too early. Reduce update throttle from 1s to
250ms for smoother progress tracking.
Add userDragging as LaunchedEffect key so the seek triggers when
the drag ends, not only when sliderPos changes.
@kdroidFilter kdroidFilter merged commit 8d0c619 into master Apr 11, 2026
10 checks passed
@kdroidFilter kdroidFilter deleted the feat/seek-api-restart-and-loop-callback branch April 11, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Seek action will occur at the beginning of sliding How to restart a video ?

1 participant